package com.zr.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;
import com.zr.util.PrintWriterUtil;

@Controller
@Scope(value="prototype")
public class QuitAction extends ActionSupport implements SessionAware,ServletResponseAware{

	private Map<String , Object> session;
	private HttpServletResponse response;
	@Override
	public void setSession(Map<String, Object> arg0) {
		// TODO Auto-generated method stub
		this.session = arg0;
	}
	
	@Override
	public void setServletResponse(HttpServletResponse arg0) {
		// TODO Auto-generated method stub
		this.response = arg0;
	}
	
	/**
	 * 退出的方法，当用户注销之后删除session中的缓存
	 */
	public void quit(){
		session.clear();
		String data = "1";
		PrintWriterUtil.getPW(response).write(data);
	}
}
